public class HF_ClientWSAccountEmail{
  @future (callout=true)
          public static void AddAccountEmail(set<Id> mailset) {
          string outputresult;
          List<Account_Email__c> mailList = new List<Account_Email__c>([select Id,Account_PIMS_Id__c,Email_Type_Code__c,Email__c,Preferred_Flag__c,Description__c from Account_Email__c where ID In: mailset]); 
          WebServiceFinal4.BasicEndpoint s = new WebServiceFinal4.BasicEndpoint();
          for(Account_Email__c mal: mailList){
                
          //Stores Email details in EmailsWrapper for Insert
                WebServiceFinal2.EmailWrapper e=new WebServiceFinal2.EmailWrapper();
                e.Comments=mal.Description__c;
                e.DataOn=system.DateTime.Now();
                e.Email=mal.Email__c;
                e.EmailType=mal.Email_Type_Code__c;
                e.NameID=0;    
                e.PartnerContactID=mal.Account_PIMS_Id__c;  
                e.PreferredEmail=mal.Preferred_Flag__c;
                e.SfdcEmailID = mal.Id;     
        try
        {
            outputresult=s.AddAccountEmail(e);
            system.debug('%%%%%%%%'+outputresult);
        }
        catch(Exception ex)
          {
            system.debug('output from webservice: '+ex);       
          }
        }       
    } 
    
    
 @future (callout=true)
      public static void UpdateAccountEmail(set<Id> mailset) {
          string outputresult;
          List<Account_Email__c> mailList = new List<Account_Email__c>([select Id,Account_PIMS_Id__c,Email_Type_Code__c,Email__c,Preferred_Flag__c,Description__c from Account_Email__c where ID In: mailset]); 
          WebServiceFinal4.BasicEndpoint s = new WebServiceFinal4.BasicEndpoint();
          for(Account_Email__c mal: mailList){
            
         //Stores Email details in EmailsWrapper for Update
                WebServiceFinal2.EmailWrapper e=new WebServiceFinal2.EmailWrapper();
                e.Comments=mal.Description__c;
                e.DataOn=system.DateTime.Now();
                e.Email=mal.Email__c;
                e.EmailType=mal.Email_Type_Code__c;
                e.NameID=0;   
                e.PartnerContactID=mal.Account_PIMS_Id__c;  
                e.PreferredEmail=mal.Preferred_Flag__c;
                e.SfdcEmailID = mal.Id;     
        try
        {
             outputresult=s.UpdateAccountEmail(e);
             system.debug('%%%%%%%%'+outputresult);
        }
        catch(Exception ex)
          {
            system.debug('output from webservice: '+ex);       
          }
        }       
} 
}